/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.partner.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;

/**
* @website https://el-admin.vip
* @description /
* @author jianyongjie@126.com
* @date 2021-08-02
**/
@Entity
@Data
@Table(name="t_partner")
public class Partner implements Serializable {

    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "商户ID")
    private Long id;

    @Column(name = "name")
    @ApiModelProperty(value = "商户名称")
    private String name;

    @Column(name = "company_name")
    @ApiModelProperty(value = "商户公司名称")
    private String companyName;

    @Column(name = "phone")
    @ApiModelProperty(value = "联系方式")
    private String phone;

    @Column(name = "address")
    @ApiModelProperty(value = "企业地址")
    private String address;

    @Column(name = "enable")
    @ApiModelProperty(value = "是否启用")
    private Boolean enable;

    @Column(name = "app_secret")
    @ApiModelProperty(value = "商户秘钥")
    private String appSecret;

    @Column(name = "remark")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Column(name = "create_by")
    @ApiModelProperty(value = "创建者")
    private String createBy;

    @Column(name = "update_by")
    @ApiModelProperty(value = "更新者")
    private String updateBy;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建日期")
    @CreationTimestamp
    private Timestamp createTime;

    @Column(name = "update_time")
    @ApiModelProperty(value = "更新时间")
    @UpdateTimestamp
    private Timestamp updateTime;

    @ApiModelProperty(value = "管理员账号")
    @Transient
    private String account;

    public void copy(Partner source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}